package math

import "jvmgo/ch05/instructions/base"
import "jvmgo/ch05/rtda"

//multiply double
type DMUL struct{
	base.NoOperandsInstruction
}

func (self *DMUL)Execute(frame *rtda.Frame){
	stack := frame.OperandStack()
	v2 := stack.PopDouble()
	v1 := stack.PopDouble()
	result := v1 * v2
	stack.PushDouble(result)
}

//multiply float
type FMUL struct{
	base.NoOperandsInstruction
}

func (self *FMUL)Execute(frame *rtda.Frame){
	stack := frame.OperandStack()
	v2 := stack.PopFloat()
	v1 := stack.PopFloat()
	result := v2 * v1
	stack.PushFloat(result)
}

//multiply int
type IMUL struct{
	base.NoOperandsInstruction
}

func (self *IMUL)Execute(frame *rtda.Frame){
	stack := frame.OperandStack()
	v2 := stack.PopInt()
	v1 := stack.PopInt()
	result := v2 * v1
	stack.PushInt(result)
}


//multiplu long
type LMUL struct{
	base.NoOperandsInstruction
}

func(self *LMUL)Execute (frame *rtda.Frame){
	stack := frame.OperandStack()
	v2 := stack.PopLong()
	v1 := stack.PopLong()
	result := v1 * v2
	stack.PushLong(result)
}
